aboutsummaryrefslogtreecommitdiff
path: root/src/pages/blog/[id].astro
diff options
context:
space:
mode:
authorAriel Costas Guerrero <ariel@costas.dev>2025-04-10 21:42:41 +0200
committerAriel Costas Guerrero <ariel@costas.dev>2025-04-10 21:42:41 +0200
commite3141794b95e534656427fadf0354435c62254d6 (patch)
tree95788249ac51475aea45ad17d7157dffd1564e47 /src/pages/blog/[id].astro
parent3caee506c961ae0e78503164ed6a0f81db3c8c32 (diff)
Fix formatting
Diffstat (limited to 'src/pages/blog/[id].astro')
-rw-r--r--src/pages/blog/[id].astro85
1 files changed, 45 insertions, 40 deletions
diff --git a/src/pages/blog/[id].astro b/src/pages/blog/[id].astro
index e1b5250..65c8a25 100644
--- a/src/pages/blog/[id].astro
+++ b/src/pages/blog/[id].astro
@@ -4,59 +4,64 @@ import { getCollection, render } from "astro:content";
import { type GetStaticPaths } from "astro";
interface Props {
- entry: any;
+ entry: any;
}
-export const getStaticPaths: GetStaticPaths = (async () => {
- const entries = await getCollection("blog");
- return entries.map((entry: any) => ({
- params: { id: entry.id },
- props: { entry },
- }));
-});
+export const getStaticPaths: GetStaticPaths = async () => {
+ const entries = await getCollection("blog");
+ return entries.map((entry: any) => ({
+ params: { id: entry.id },
+ props: { entry },
+ }));
+};
const { entry } = Astro.props;
const { Content } = await render(entry);
const formattedDate = new Date(entry.data.publishedAt).toLocaleDateString(
- "es-ES",
- {
- year: "numeric",
- month: "long",
- day: "numeric",
- weekday: "long",
- },
+ "es-ES",
+ {
+ year: "numeric",
+ month: "long",
+ day: "numeric",
+ weekday: "long",
+ },
);
const schema = {
- "@context": "https://schema.org",
- "@type": "BlogPosting",
- headline: entry.data.title,
- datePublished: entry.data.publishedAt.toISOString(),
- author: {
- "@type": "Person",
- name: "Ariel Costas Guerrero",
- },
- publisher: {
- "@type": "Person",
- name: "Ariel Costas Guerrero",
- logo: {
- "@type": "ImageObject",
- url: "https://www.costas.dev/favicon.png",
- },
- },
+ "@context": "https://schema.org",
+ "@type": "BlogPosting",
+ headline: entry.data.title,
+ datePublished: entry.data.publishedAt.toISOString(),
+ author: {
+ "@type": "Person",
+ name: "Ariel Costas Guerrero",
+ },
+ publisher: {
+ "@type": "Person",
+ name: "Ariel Costas Guerrero",
+ logo: {
+ "@type": "ImageObject",
+ url: "https://www.costas.dev/favicon.png",
+ },
+ },
};
---
<Layout title={entry.data.title} description={entry.data.metaDescription}>
- <script is:inline type="application/ld+json" slot="head-jsonld" set:html={JSON.stringify(schema)}></script>
+ <script
+ is:inline
+ type="application/ld+json"
+ slot="head-jsonld"
+ set:html={JSON.stringify(schema)}
+ />
- <h1>{entry.data.title}</h1>
- <small>
- Publicado el
- <time datetime={entry.data.publishedAt.toISOString()}>
- {formattedDate}
- </time>
- </small>
+ <h1>{entry.data.title}</h1>
+ <small>
+ Publicado el
+ <time datetime={entry.data.publishedAt.toISOString()}>
+ {formattedDate}
+ </time>
+ </small>
- <Content />
+ <Content />
</Layout>